import lylrequest from '../index'
import { IAccount, IDataType, ILoginResult } from './type'

enum LoginAPI {
  AccountLogin = '/login',
  LoginUserInfo = '/users/',
  UserMenus = '/role/'
}

// 登录请求
export function accountLoginRequest(accout: IAccount) {
  return lylrequest.post<IDataType<ILoginResult>>({
    url: LoginAPI.AccountLogin,
    data: accout,
    showLoading: true
  })
}
// 用户信息
export function requestUserInfoById(id: number) {
  return lylrequest.get<IDataType>({
    url: LoginAPI.LoginUserInfo + id
  })
}
// 用户菜单信息
export function requestUserMenusByRoleId(id: number) {
  return lylrequest.get<IDataType>({
    url: LoginAPI.UserMenus + id + '/menu'
  })
}
